package com.dindang.checkline.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.dindang.checkline.di.module.TaskDetailModule;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;

import com.dindang.checkline.di.component.DaggerTaskDetailComponent;
import com.dindang.checkline.mvp.contract.TaskDetailContract;
import com.dindang.checkline.mvp.presenter.TaskDetailPresenter;

import com.dindang.checkline.R;


import static com.jess.arms.utils.Preconditions.checkNotNull;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 03/05/2019 16:39
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
//任务详情单页面（待办任务单列表点击跳转的页面）
@Route(path = "/checkline/TaskDetailActivity")
public class TaskDetailActivity extends BaseActivity<TaskDetailPresenter> implements TaskDetailContract.View  {
    ImageView mIvBack;
    TextView mTvTitle;
    RecyclerView mRvProgress;
    ConstraintLayout mConstraintlayout;

    TextView mTvState;
    TextView mTvLineNameValue;
    TextView mTvCheckTypeValue;
    TextView mTvCheckManValue;
    TextView mTvSignWayValue;
    TextView mTvIsOrderValue;
    TextView mTvIsCameraValue;
    TextView mTvPlanTimeValue;
    TextView mTvTaskNumValue;
    TextView mTvProjectNameValue;

    TextView mButtonGetTask;
    TextView mButtonErrorEnd;
    TextView mButtonSeeDetail;

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerTaskDetailComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .taskDetailModule(new TaskDetailModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_task_detail; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        mIvBack = findViewById(R.id.maintenance_iv_back);
        mTvTitle = findViewById(R.id.maintenance_tv_title);
        mRvProgress = findViewById(R.id.maintenance_rv_progress);
        mRvProgress.setNestedScrollingEnabled(false);
        mRvProgress.setFocusable(false);
        mConstraintlayout = findViewById(R.id.maintenance_constraintlayout);
        mTvState = findViewById(R.id.maintenance_tv_state);
        mTvTitle.setText("任务单详情");
        mTvTitle.setOnClickListener(v -> finish());
        mIvBack.setOnClickListener(v -> finish());
        mTvLineNameValue = findViewById(R.id.maintenance_tv_orderno_value);
        mTvCheckTypeValue = findViewById(R.id.maintenance_tv_repair_area_value);
        mTvCheckManValue = findViewById(R.id.maintenance_tv_repair_man_value);
        mTvSignWayValue = findViewById(R.id.maintenance_tv_sign_way_value);
        mTvIsOrderValue = findViewById(R.id.maintenance_tv_order_value);
        mTvIsCameraValue = findViewById(R.id.maintenance_tv_iscamera_value);
        mTvPlanTimeValue = findViewById(R.id.maintenance_tv_appointment_time_value);
        mTvTaskNumValue = findViewById(R.id.maintenance_tv_task_num_value);
        mTvProjectNameValue = findViewById(R.id.maintenance_tv_project_name_value);
        mButtonGetTask = findViewById(R.id.maintenance_tv_send_order);
        mButtonErrorEnd = findViewById(R.id.maintenance_tv_plan);
        mButtonSeeDetail = findViewById(R.id.button_begin);

        mPresenter.init();
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    @Override
    public ImageView getIvBack() {
        return mIvBack;
    }

    @Override
    public TextView getTvTitle() {
        return mTvTitle;
    }

    @Override
    public RecyclerView getRvProgress() {
        return mRvProgress;
    }

    @Override
    public ConstraintLayout getConstraintlayout() {
        return mConstraintlayout;
    }

    @Override
    public TextView getTvState() {
        return mTvState;
    }

    @Override
    public TextView getTvLineNameValue() {
        return mTvLineNameValue;
    }

    @Override
    public TextView getTvCheckTypeValue() {
        return mTvCheckTypeValue;
    }

    @Override
    public TextView getTvCheckManValue() {
        return mTvCheckManValue;
    }

    @Override
    public TextView getTvSignWayValue() {
        return mTvSignWayValue;
    }

    @Override
    public TextView getTvIsOrderValue() {
        return mTvIsOrderValue;
    }

    @Override
    public TextView getTvIsCameraValue() {
        return mTvIsCameraValue;
    }

    @Override
    public TextView getTvPlanTimeValue() {
        return mTvPlanTimeValue;
    }

    @Override
    public TextView getTvTaskNumValue() {
        return mTvTaskNumValue;
    }

    @Override
    public TextView getTvProjectNameValue() {
        return mTvProjectNameValue;
    }

    @Override
    public TextView getButtonGetTask() {
        return mButtonGetTask;
    }

    @Override
    public TextView getButtonSeeDetail() {
        return mButtonSeeDetail;
    }

    @Override
    public TextView getButtonErrorEnd() {
        return mButtonErrorEnd;
    }

    @Override
    public BaseActivity getActivity() {
        return this;
    }
}
